home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
IPFlakeWay
/
Squelch Module
/
source
/
NatRTSP.h
< prev
next >
Wrap
Text File
|
2000-06-23
|
3KB
|
73 lines
// =================================================================================
// NatRTSP.h ©1999 Sustainable Softworks. All rights reserved.
// =================================================================================
// Network Address Translation for RTSP SETUP commands.
// Opens a return path through the firewall (NAT function) for client
// streams specified in RTSP SETUP commands.
// This module translates the data portion of IP datagrams
// (technically a layering violation).
//
// Since we must operate in the STREAMS context, this module is written
// in traditional C (not C++).
#ifndef _H_NatRTSP
#define _H_NatRTSP
#pragma once
#include "NatTable.h"
#define nilp(type) ((type*)0)
// ---------------------------------------------------------------------------
// • Convert2ApparentRTSP
// ---------------------------------------------------------------------------
// Convert outgoing datagrams to appear as if they originate from
// the apparent endpoint. Return false if not a valid datagram or
// no translation entry could be found or created.
//
// Handle RTSP control channel
// We assume there can only be one SETUP command per segment!
Boolean
Convert2ApparentRTSP(translationEntry_t table[],
UInt8* datagram,
mblk_t* mp,
translationEntry_t* inLookupEntry,
ip_header_t* ipHeader,
tcp_header_t* tcpHeader);
// ---------------------------------------------------------------------------
// • Convert2ActualRTSP
// ---------------------------------------------------------------------------
// Convert incomming datagram addressed to an apparent endpoint to
// be forwarded to the corresponding actual endpoint.
//
// Handle RTSP control channel
// We assume there can only be one PORT command per segment!
Boolean
Convert2ActualRTSP(translationEntry_t table[],
UInt8* datagram,
mblk_t* mp,
translationEntry_t* inLookupEntry,
ip_header_t* ipHeader,
tcp_header_t* tcpHeader);
// ---------------------------------------------------------------------------
// • DecodeRTSPClientPort
// ---------------------------------------------------------------------------
// Convert RTSP client_port="aaaa-bbbb" command to a protocol port range
// Return length of port range data, or Zero if command error detected
UInt8
DecodeRTSPClientPort(char* inStr, UInt16* outPortA, UInt16* outPortB);
// ---------------------------------------------------------------------------
// • EncodeRTSPClientPort
// ---------------------------------------------------------------------------
// Convert protocol port range to RTSP client_port="aaaa-bbbb" command
// Output as null terminated string.
UInt8
EncodeRTSPClientPort(UInt16 inPortA, UInt16 inPortB, char* outStr);
#define kRTSPControlPort 554
#define kRTSPAlternatePort 7070
#endif